<script type="text/javascript" src="./Public/js/jgsat.js"></script>

<script type="text/javascript">
function sub_save(){
	$("#myform2").submit();
	}
</script>
 <!-- 共用头部1 -->
	 <div id="top">
		 <div class="head1 clear">
			 <div class="account sprite_icon" style="text-align:center; ">
                  <a href="index.php?g=Mobile&m=User&a=index" style=" color:#FFF; line-height:50px">
                 {if cookie('username')}
                  {php $user=M('User')->field('username')->where('id='.$jgsatuserid)->find()}
                  {php echo $user['username']} 
                 {else}登录
                 {/if}
                 </a>
			 </div>
			 {if $title}
			    <div class="title">{$title}</div> 
               {else}
                <div class="title">{$seo_title}</div> 
               {/if}<div class="search sprite_icon" onclick="sub_save()">
			     <span class="keep" >保存</span>
			 </div>
		 </div>
	 </div>	
<include file="Mobile:nav"/> 
	 <div class="data Padding clear P_color">
		 <div class="pic demo">
			<a class="sty" onclick="clp()"  class="btn" id="btn">
				 <img src="{$vo.avatar}" id="head_photo_src" alt="" />
				  <p>编辑头像</p>
             </a><input type="file" name="head_photo" id="head_photo" value="" style="display:none">  
                  <input  type="hidden" name="photo_pic" id="photo_pic" value="">
		  <ul id="ul_pics" class="ul_pics clearfix"></ul>
		 </div>

		 <div class="info">
			 <div>
				 <strong>绑定邮箱：</strong>
				 <em>{if $vo[email]}{$vo[email]} {else} 未设置{/if}</em> 
				
			  {if $vo[email]}<a style="color:#F00;float: right;"  href="/index.php?g=Mobile&m=User&a=mobile_email"> 解绑</a>{else} <a style="color:#F00;float:right;"  href="/index.php?g=Mobile&m=User&a=mobile_email">立即设置</a>{/if}
             </div>
			<!-- <div>
				 <strong>绑定手机：</strong>
				 <em>178***89</em>
				 <a href="javascript:;">换绑</a>
			 </div>-->
			 <div>
				 <strong>登录密码：</strong>
				 <em>*******</em> 
				 <a href="index.php?g=Mobile&m=Register&a=edit">修改密码</a>
			 </div>
		 </div>
	 </div>
 <form method='post' id="myform2"  action="{:URL('Mobile-User/guestbook')}" >
 <input type="hidden" name="id" value="{$vo.id}" />

	   <div class="P_text p_topBorder Padding">
		 <strong>身份类型：</strong><span>业主</span>
	 </div>
	 <div class="P_text Padding">
		 <strong>昵称：</strong><input type="text" disabled="disabled" name="nickname" id="name1" size="12" value="{$vo[realname]}" />
	 </div>
	 <div class="P_text Padding">
		 <strong>QQ：</strong><input name="qq" type="text" id="name7"  value="{$vo[qq]}" />
	 </div>
	 <div class="P_text Padding">
		 <strong>所在地区：</strong><span>
            <select name="province" id="province" validate=" required:true" onchange="area_change(this.value, 1,'province','city','area');" class="selt mr5" >
            	<option value="0">省份</option>
            </select>
            <select name="city"  id="city" validate=" required:true" onchange="area_change(this.value, 2,'province','city','area');" id="city" class="selt mr5" >
                <option value="0">城市</option>
            </select>
           
            <script>area_change(0, 0,'province','city','area',{if $vo[province]!=0}{$vo[province]}{else}0{/if},{if $vo[city]!=0}{$vo[city]}{else}0{/if},{if $vo[area]!=0}{$vo[area]}{else}0{/if});
			</script>
         
         </span>
	 </div>
	 <!--<div class="P_text Padding clear">
		 <strong>装修阶段：</strong><span>还没选好店面</span><em></em>
	 </div>-->
	 <div class="P_text Padding">
		 <strong>餐馆名称：</strong> <input name="cafe_name" type="text" id="name9"  value="{$vo[cafe_name]}" />
	 </div>
     <div class="P_text Padding">
		 <strong>装修阶段：</strong> <input name="charge" type="text" id="name11"  value="{$vo[charge]}" />
	 </div>
	 <div class="P_text Padding">
		 <span class="txspan">餐馆简介：</span><span> <textarea name="my_introduce" class="wind_textar1" id="name10">{$vo[my_introduce]}</textarea></span>
	 </div>

     <div class="mask"></div>

     <div class="safe">
         <div class="phone com" style="display:none;">
             <h3>手机换绑</h3>
             <div class="text1 text clear">
                 <span>手机：</span>
                 <input type="text" class="txt" />
             </div>
             <div class="text2 text clear">
                 <span>验证码：</span>
                 <input type="text" class="txt2" />
                 <a href="javascript:;" class="send">发送验证码</a>
             </div>

             <input type="button" value="确认" class="btn"/>

             <i class="close">&times;</i>
         </div>

         <div class="email com" style="display:none;">
             <h3>邮箱换绑</h3>
             <div class="text1 text clear">
                 <span>邮箱：</span>
                 <input type="text" class="txt" />
             </div>
             <div class="text2 text clear">
                 <span>验证码：</span>
                 <input type="text" class="txt2" />
                 <a href="javascript:;" class="send">发送验证码</a>
             </div>

             <input type="button" value="确认绑定" class="btn"/>

             <i class="close">&times;</i>
         </div>

         <div class="change com">
             <h3>修改登录密码</h3>
             <div class="text1 text clear">
                 <span>旧密码：</span>
                 <input type="text" class="txt" />
             </div>
             <div class="text1 text clear">
                 <span>新密码：</span>
                 <input type="text" class="txt" />
             </div>
             <div class="text1 text clear">
                 <span>新密码：</span>
                 <input type="text" class="txt" />
             </div>

             <input type="button" value="确认" class="btn"/>

             <i class="close">&times;</i>
         </div>
     </div>
           <input type="hidden" id="avatar" name="avatar"  value="{$vo.avatar}"/>
           
   </form>
   
  <script type="text/javascript" src="./Public/avarat/js/ajaxfileupload.js"></script>
<script type="text/javascript" src="./Public/avarat/js/artDialog4.1.6/jquery.artDialog.js?skin=default"></script>
<script type="text/javascript" src="./Public/avarat/js/artDialog4.1.6/plugins/iframeTools.js"></script>
<script>
 function clp(){
   return  $("#head_photo").click();
 }
$(document).ready(function(e){
		
	$('#head_photo').live('change',function(){ 
		ajaxFileUploadview('head_photo','photo_pic',"index.php?g=Mobile&m=Upload&a=avarat");
	});	

});


function show_head(head_file){
	
	//插入数据库
	//$.post("{:U('Home/Index/update_head')}",{head_file:head_file},function(result){		
		$("#head_photo_src").attr('src',head_file);
		$("#avatar").val(head_file);		
	//});	

}

//文件上传带预览
function ajaxFileUploadview(imgid,hiddenid,url){
		
		
		$.ajaxFileUpload
		({
			url:url,
			secureuri:false,
			fileElementId:imgid,
			dataType: 'json',
			data:{name:'logan', id:'id'},
			success: function (data, status)
			{
				if(typeof(data.error) != 'undefined')
				{
					if(data.error != '')
					{
						var dialog = art.dialog({title:false,fixed: true,padding:0});
						dialog.time(2).content("<div class='tips'>"+data.error+"</div>");
					}else{

						var resp = data.msg;						
						if(resp != '0000'){
							var dialog = art.dialog({title:false,fixed: true,padding:0});
							dialog.time(2).content("<div class='tips'>"+data.error+"</div>");
							return false;
						}else{
							$('#'+hiddenid).val(data.imgurl);						

							art.dialog.open("index.php?g=Mobile&m=Upload&a=avarat_img&img="+data.imgurl,{
								title: '裁剪头像',
								width:'90%',
								height:'100%'
							});						
							
							//dialog.time(3).content("<div class='msg-all-succeed'>上传成功！</div>");
						}
									

						
						
					}
				}
			},
			error: function (data, status, e)
			{

				dialog.time(3).content("<div class='tips'>"+e+"</div>");
			}
		})

		return false;
	}

</script>
